<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\model\Article as ArticleModel;
use app\model\Banner as BannerModel;

/**
 * 首页接口
 */
class Banner extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function indexBanner()
    {

        $bannerModelHandle = new BannerModel();
        $bannerData = $bannerModelHandle->getAllBanner();
        $bannerData = $this->formateDataBylang($bannerData,['name','descript']);
        $banner = $bannerData[2];
        if(strpos($banner."kkk",'.mp4') || strpos($banner."kkk",'.mov')){
            $banner['video'] = 1;
        }else{
            $banner['video'] = 0;
        }

        $huanjin1 = $bannerData[3];
        $huanjin2 = $bannerData[4];
        $huanjin3 = $bannerData[5];
        $ourStore = $bannerData[11];
        if(strpos($ourStore."kkk",'.mp4') || strpos($ourStore."kkk",'.mov')){
            $ourStore['video'] = 1;
        }else{
            $ourStore['video'] = 0;
        }
        $this->success('ok',compact('banner','huanjin1','huanjin2','huanjin3','ourStore'));

    }

    public function aboutBanner()
    {

        $bannerModelHandle = new BannerModel();
        $bannerData = $bannerModelHandle->getAllBanner();
        $bannerData = $this->formateDataBylang($bannerData,['name','descript']);
        $gongzuoshi1 = $bannerData[6];
        $gongzuoshi2 = $bannerData[7];
        $gongzuoshi3 = $bannerData[8];
        $gongzuoshi4 = $bannerData[9];
        $qiantai = $bannerData[10];
        $this->success('ok',compact('gongzuoshi1','gongzuoshi2','gongzuoshi3','gongzuoshi4','qiantai'));

    }
}
